// index.js
Page({
    // data是页面的数据,是一个对象
    data: {
        msg: "您好",
        srcUrl: "https://iknow-pic.cdn.bcebos.com/d833c895d143ad4b1939615390025aafa40f0609?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto",
        person: {
            name: "zs",
            age: 23
        }
    },
    // 事件定义在data同级
    // Vue 是 this.xxx
    // 微信小程序 是 this.data.xxx
    fn1() {
        console.log("fn111111");
    },
    fn2() {
        console.log(this.data.msg);
        // 修改
        // vue 是this.xxx = yyy
        // 微信小程序是 this.setData({ xxx:yyy })
        this.setData({
            msg: this.data.msg + "giao!"
        })
    },
    fn3(event) {
        let str = event.target.dataset.str
        this.setData({
            msg:this.data.msg + str
        })
    },
    fnSm(event) {
        console.log(event.target);
    },
    fnBg(event) {
        console.log(event.target);
    },
})